package cvsexercise1;

public class BasicArithmetic {
	
	/* Some constant values for arithmetic operations */
	public static final int ADDITION_VALUE = 10;
	public static final int SUBTRACTION_VALUE = 50;
	public static final int MULTIPLICATION_VALUE = 25;
	public static final int DIVISION_VALUE = 75;
	public static final int NUMBER_A = 2;
	public static final int NUMBER_B = 10;
	public static final int NUMBER_C = 7;
	

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		/* Output a start message to the console */
		System.out.println("Exercise 1 - Arithmetic started");
		
		/* Declare and initialize some numeric variables */
		int myInt = 100;
		int nResult = 0;
				
		/* Write the initial value of the myInt variable to the console */
		System.out.println("Initial value of myInt = " + myInt);
		
		/* Perform addition, subtraction, multiplication, division and remainder operations */
		/* Addition (ADDITION_VALUE) */		
		nResult = myInt + ADDITION_VALUE;
		System.out.println("Result of addition = " + nResult);
		
		/* Subtraction (SUBTRACTION_VALUE) */
		nResult = myInt - SUBTRACTION_VALUE;
		System.out.println("Result of subtraction = " + nResult);
		
		/* Multiplication (MULTIPLICATION_VALUE) */
		nResult = myInt * MULTIPLICATION_VALUE;
		System.out.println("Result of multiplication = " + nResult);
		
		/* Division (DIVISION_VALUE) */
		nResult = myInt / DIVISION_VALUE;
		System.out.println("Result of division = " + nResult);
		
		/* Remainder (DIVISION_VALUE) */
		nResult = myInt % DIVISION_VALUE;
		System.out.println("Result of remainder = " + nResult);
		
		/* Use Compound Assignment Operator for addition */
		myInt += ADDITION_VALUE;
		System.out.println("Result of compound addition = " + myInt);
		
		/* Use preincrement operator */
		myInt = 0; //Initialize myInt to 0
		nResult = ++myInt;
		System.out.println("Using preincrement operator myInt = " + myInt);
		System.out.println("Using preincrement operator nResult = " + nResult);
		
		/* Use postincrement operator */
		myInt = 0;
		nResult = myInt++;
		System.out.println("Using postincrement operator myInt = " + myInt);
		System.out.println("Using postincrement operator nResult = " + nResult);
		
		/* Calculate NUMBER_A * NUMBER_B + NUMBER_C */
		nResult = NUMBER_A * NUMBER_B + NUMBER_C;
		System.out.println("NUMBER_A * NUMBER_B + NUMBER_C = " + nResult);
		
		/* Calculate NUMBER_A * (NUMBER_B + NUMBER_C) */
		nResult = NUMBER_A * (NUMBER_B + NUMBER_C);
		System.out.println("NUMBER_A * NUMBER_B + NUMBER_C = " + nResult);		
		
		/* Output a completed message to the console */
		System.out.println("Exercise 1 - Arithmetic completed");
	}
}
